<template>
  <div>
    <div style="margin:5px;display: inline-block;">
      <span>昵称:</span>
      <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入昵称"
        v-model="nickName"></el-input>
    </div>&emsp;&emsp;
    <div style="margin:5px;display: inline-block;">
      <span>手机号:</span>
      <el-input style="width: 150px;" @keydown.enter.native="select" clearable placeholder="请输入手机号"
        v-model="phone"></el-input>
    </div>&emsp;&emsp;
    <div style="margin:5px;display: inline-block;">
      <span>邀请码:</span>
      <el-input style="width: 150px;" @keydown.enter.native="select" placeholder="请输入邀请码" v-model="invitationCode">
      </el-input>
    </div>
    <div style="margin:5px;display: inline-block;">
      <span>邀请人邀请码:</span>
      <el-input style="width: 150px;" @keydown.enter.native="select" placeholder="请输入邀请人邀请码" v-model="inviterCode">
      </el-input>
    </div>
    
    <div style="margin:5px;display: inline-block;">
      <span>渠道来源：</span>
      <el-select v-model="platform" style="width:150px;margin-left: 10px;" @change="animeDat2(platform)">
        <el-option v-for="item in homeData1" :key="item.id" :label="item.name" :value="item.id">
        </el-option>
      </el-select>&nbsp;&nbsp;&nbsp;
    </div>
    <!-- <div style="margin:5px;display: inline-block;">
      <span>代理商名称:</span>
      <el-input style="width: 150px;" @keydown.enter.native="select" placeholder="请输入代理商名称" v-model="dailiName">
      </el-input>
    </div> -->
    <div style="display: inline-block;">
      <el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="select">查询
      </el-button>
      <el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleans">重置
      </el-button>
    </div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="全部用户" name="first">

        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column fixed prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{ scope.row.nickName ? scope.row.nickName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
					<el-table-column prop="phone" label="手机号">
					  <template slot-scope="scope">
					    <span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
					      {{ scope.row.phone ? scope.row.phone : '未绑定' }}
					    </span>
					  </template>
					</el-table-column>
         <!-- <el-table-column  prop="dailiName" label="代理商名称" width="150">
          </el-table-column> -->
          <el-table-column prop="zhifubaoName" label="是否是普通用户">
            <template slot-scope="scope">
              <!-- <span v-if="scope.row.openId||scope.row.wxOpenId">是</span>
              <span v-else>否</span> -->
							<span v-if="scope.row.userType==1">是</span>
							<span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是师傅用户">
            <template slot-scope="scope">
             <!-- <span v-if="scope.row.riderOpenId||scope.row.riderWxOpenId">是</span>
              <span v-else>否</span> -->
							<span v-if="scope.row.userType==2">是</span>
							<span v-else>否</span>
            </template>
          </el-table-column>
          <el-table-column prop="riderLevel" label="师傅等级">
            <template slot-scope="scope">
              <div v-if="scope.row.userType==2">
                <span v-if="scope.row.riderLevel==1">普通</span>
                <span v-if="scope.row.riderLevel==2">优享</span>
                <span v-if="scope.row.riderLevel==3">超级优享</span>
              </div>
             <span v-else> - </span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是推广员">
            <template slot-scope="scope">
              <span v-if="scope.row.divideScale==0||scope.row.divideScale==null">否</span>
              <span v-else>是</span>
            </template>
          </el-table-column>
		  <el-table-column prop="rate" label="师傅佣金比例" width="150">
		    <template slot-scope="scope">
		      <span>{{scope.row.rate}}</span>
		      <div>
		        <el-input @keydown.enter.native="addition(scope.row,3)" v-model="scope.row.rate" clearable
		          placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
		          <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,3)"></i>
		        </el-input>
		      </div>
		    </template>
		  </el-table-column>
          <el-table-column prop="grade" label="一级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,1)" v-model="scope.row.divideScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,1)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="divideTwoScale" label="二级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideTwoScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,2)" v-model="scope.row.divideTwoScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,2)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="渠道来源" width="120">
          </el-table-column>

          <el-table-column prop="zhifubaoName" label="是否实名">
            <template slot-scope="scope">
              <span v-if="scope.row.checkCertification=='0'">待审核</span>
              <span v-else-if="scope.row.checkCertification=='1'">已实名</span>
              <span v-else>未实名</span>
            </template>
          </el-table-column>
          <el-table-column prop="invitationCode" label="邀请码"></el-table-column>
          <el-table-column label="邀请人邀请码">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates2(scope.row)">{{ scope.row.inviterCode ? scope.row.inviterCode : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
                暂无收款二维码
              </div>
              <div v-else style="display:flex;flex-wrap: wrap;">
                <div style="margin: 2px;">
                  <el-popover placement="top-start" title="" trigger="hover">
                    <img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
                    <img style="width: 300px; height: 300px" :src="scope.row.cashQrCode" alt="">
                  </el-popover>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubao ? scope.row.zhifubao : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>
          <el-table-column prop="state " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :active-value="openValue" :inactive-value="closeValue" active-color="#13ce66"
                :disabled="!isAuth('userList:updateStatus')" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情</el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">删除用户</el-button>
              <!-- <el-button size = "mini" type = "danger" @click = "updates1(scope.row)">封号</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 15, 20]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>

      <el-tab-pane label="普通用户" name="putong">
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column fixed prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{ scope.row.nickName ? scope.row.nickName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
					<el-table-column prop="phone" label="手机号">
					  <template slot-scope="scope">
					    <span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
					      {{ scope.row.phone ? scope.row.phone : '未绑定' }}
					    </span>
					  </template>
					</el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是普通用户">
           <template slot-scope="scope">
             <!-- <span v-if="scope.row.openId||scope.row.wxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==1">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是师傅用户">
           <template slot-scope="scope">
            <!-- <span v-if="scope.row.riderOpenId||scope.row.riderWxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==2">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>

          <el-table-column prop="zhifubaoName" label="是否是推广员">
            <template slot-scope="scope">
              <span v-if="scope.row.divideScale==0||scope.row.divideScale==null">否</span>
              <span v-else>是</span>
            </template>
          </el-table-column>
		  <el-table-column prop="rate" label="师傅佣金比例" width="150">
		    <template slot-scope="scope">
		      <span>{{scope.row.rate}}</span>
		      <div>
		        <el-input @keydown.enter.native="addition(scope.row,3)" v-model="scope.row.rate" clearable
		          placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
		          <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,3)"></i>
		        </el-input>
		      </div>
		    </template>
		  </el-table-column>
          <el-table-column prop="grade" label="一级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,1)" v-model="scope.row.divideScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,1)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="divideTwoScale" label="二级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideTwoScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,2)" v-model="scope.row.divideTwoScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,2)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>

          <el-table-column prop="platform" label="渠道来源" width="120">
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否实名">
            <template slot-scope="scope">
              <span v-if="scope.row.checkCertification=='0'">待审核</span>
              <span v-else-if="scope.row.checkCertification=='1'">已实名</span>
              <span v-else>未实名</span>
            </template>
          </el-table-column>
          <el-table-column prop="invitationCode" label="邀请码"></el-table-column>
          <el-table-column label="邀请人邀请码">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates2(scope.row)">{{ scope.row.inviterCode ? scope.row.inviterCode : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
                暂无收款二维码
              </div>
              <div v-else style="display:flex;flex-wrap: wrap;">
                <div style="margin: 2px;">
                  <el-popover placement="top-start" title="" trigger="hover">
                    <img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
                    <img style="width: 300px; height: 300px" :src="scope.row.cashQrCode" alt="">
                  </el-popover>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubao ? scope.row.zhifubao : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>
          <el-table-column prop="state " label="状态">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :active-value="openValue" :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情</el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">删除用户</el-button>
              <!-- <el-button size = "mini" type = "danger" @click = "updates1(scope.row)">封号</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 15, 20]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="师傅用户" name="qishou">
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column fixed prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{ scope.row.nickName ? scope.row.nickName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
					<el-table-column prop="phone" label="手机号">
					  <template slot-scope="scope">
					    <span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
					      {{ scope.row.phone ? scope.row.phone : '未绑定' }}
					    </span>
					  </template>
					</el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是普通用户">
           <template slot-scope="scope">
             <!-- <span v-if="scope.row.openId||scope.row.wxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==1">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是师傅用户">
           <template slot-scope="scope">
            <!-- <span v-if="scope.row.riderOpenId||scope.row.riderWxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==2">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>
         <el-table-column prop="riderLevel" label="师傅等级">
           <template slot-scope="scope">
         		<span v-if="scope.row.riderLevel==1">普通</span>
         		<span v-if="scope.row.riderLevel==2">优享</span>
         		<span v-if="scope.row.riderLevel==3">超级优享</span>
           </template>
         </el-table-column>

          <el-table-column prop="zhifubaoName" label="是否是推广员">
            <template slot-scope="scope">
              <span v-if="scope.row.divideScale==0||scope.row.divideScale==null">否</span>
              <span v-else>是</span>
            </template>
          </el-table-column>
		  <el-table-column prop="rate" label="师傅佣金比例" width="150">
		    <template slot-scope="scope">
		      <span>{{scope.row.rate}}</span>
		      <div>
		        <el-input @keydown.enter.native="addition(scope.row,3)" v-model="scope.row.rate" clearable
		          placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
		          <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,3)"></i>
		        </el-input>
		      </div>
		    </template>
		  </el-table-column>
          <el-table-column prop="grade" label="一级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,1)" v-model="scope.row.divideScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,1)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="divideTwoScale" label="二级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideTwoScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,2)" v-model="scope.row.divideTwoScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,2)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="渠道来源" width="120">
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否实名">
            <template slot-scope="scope">
              <span v-if="scope.row.checkCertification=='0'">待审核</span>
              <span v-else-if="scope.row.checkCertification=='1'">已实名</span>
              <span v-else>未实名</span>
            </template>
          </el-table-column>
          <el-table-column prop="invitationCode" label="邀请码"></el-table-column>
          <el-table-column label="邀请人邀请码">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates2(scope.row)">{{ scope.row.inviterCode ? scope.row.inviterCode : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
                暂无收款二维码
              </div>
              <div v-else style="display:flex;flex-wrap: wrap;">
                <div style="margin: 2px;">
                  <el-popover placement="top-start" title="" trigger="hover">
                    <img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
                    <img style="width: 300px; height: 300px" :src="scope.row.cashQrCode" alt="">
                  </el-popover>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubao ? scope.row.zhifubao : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>

          <el-table-column prop="onLineFlag" label="师傅状态" fixed="right">
            <template slot-scope="scope">
              <span v-if="scope.row.onLineFlag==1">在线接单</span>
              <span v-else>停止接单</span>
            </template>
          </el-table-column>
          <el-table-column prop="state" label="用户状态" fixed="right">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :active-value="openValue" :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情</el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">删除用户</el-button>
              <!-- <el-button size = "mini" type = "danger" @click = "updates1(scope.row)">封号</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 15, 20]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>

      <!-- <el-tab-pane label="代理商用户" name="daili">
				<el-table v-loading="tableDataLoading" :data="tableData.list">
					<el-table-column fixed prop="userId" label="编号" width="80" fixed="left">
					</el-table-column>
					<el-table-column fixed prop="nickName" label="昵称" width="150">
						<template slot-scope="scope">
							<span style="color: #f56c6c;">{{ scope.row.nickName ? scope.row.nickName : '未绑定' }}</span>
						</template>
					</el-table-column>
					<el-table-column label="图像">
						<template slot-scope="scope">
							<img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40"
								height="40">
							<img v-else :src="scope.row.avatar" alt="" width="40" height="40">
						</template>
					</el-table-column>
					<el-table-column prop="zhifubaoName" label="是否是普通用户">
						<template slot-scope="scope">
							<span v-if="scope.row.openId||scope.row.wxOpenId">是</span>
							<span v-else>否</span>
						</template>
					</el-table-column>
					<el-table-column prop="zhifubaoName" label="是否是师傅用户">
						<template slot-scope="scope">
							<span v-if="scope.row.riderOpenId||scope.row.riderWxOpenId">是</span>
							<span v-else>否</span>
						</template>
					</el-table-column>
					<el-table-column prop="zhifubaoName" label="是否是推广员">
						<template slot-scope="scope">
							<span v-if="scope.row.divideScale==0||scope.row.divideScale==null">否</span>
							<span v-else>是</span>
						</template>
					</el-table-column>
					<el-table-column prop="grade" label="佣金比例" width="150">
					  <template slot-scope="scope">
					    <span>{{scope.row.divideScale}}</span>
					    <div>
					      <el-input type="text" @keydown.enter.native="addition(scope.row)" v-model="scope.row.divideScale" clearable
					        placeholder="例0.3" style="width: 120px;font-size:14px;">
					        <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row)"></i>
					      </el-input>
					    </div>
					  </template>
					</el-table-column>
					<el-table-column prop="platform" label="渠道来源" width="120">
					</el-table-column>
					<el-table-column prop="phone" label="手机号">
						<template slot-scope="scope">
							<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
								{{ scope.row.phone ? scope.row.phone : '未绑定' }}
							</span>
						</template>
					</el-table-column>
					<el-table-column prop="zhifubaoName" label="是否实名">
						<template slot-scope="scope">
							<span v-if="scope.row.checkCertification=='0'">待审核</span>
							<span v-else-if="scope.row.checkCertification=='1'">已实名</span>
							<span v-else>未实名</span>
						</template>
					</el-table-column>
					<el-table-column prop="invitationCode" label="邀请码"></el-table-column>
					<el-table-column label="邀请人邀请码">
						<template slot-scope="scope">
							<span style="color: #4f9dec;cursor: pointer;"
								@click="updates2(scope.row)">{{ scope.row.inviterCode ? scope.row.inviterCode : '未绑定' }}</span>
						</template>
					</el-table-column>
					<el-table-column prop="cashQrCode" label="收款二维码" width="150">
						<template slot-scope="scope">
							<div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
								暂无收款二维码
							</div>
							<div v-else style="display:flex;flex-wrap: wrap;">
								<div style="margin: 2px;">
									<el-popover placement="top-start" title="" trigger="hover">
										<img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt=""
											slot="reference">
										<img style="width: 300px; height: 300px" :src="scope.row.cashQrCode" alt="">
									</el-popover>
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="zhifubaoName" label="支付宝名称">
						<template slot-scope="scope">
							<span>{{ scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定' }}</span>
						</template>
					</el-table-column>
					<el-table-column prop="zhifubao" label="支付宝账号">
						<template slot-scope="scope">
							<span>{{ scope.row.zhifubao ? scope.row.zhifubao : '未绑定' }}</span>
						</template>
					</el-table-column>
					<el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>

					<el-table-column prop="onLineFlag" label="师傅状态" fixed="right">
						<template slot-scope="scope">
							<span v-if="scope.row.onLineFlag==1">在线接单</span>
							<span v-else>停止接单</span>
						</template>
					</el-table-column>
					<el-table-column prop="state" label="用户状态" fixed="right">
						<template slot-scope="scope">
							<el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
								:active-value="openValue" :inactive-value="closeValue" active-color="#13ce66"
								inactive-color="#ff4949">
							</el-switch>
						</template>
					</el-table-column>
					<el-table-column fixed="right" label="操作" width="120">
						<template slot-scope="scope">
							<el-button size="mini" type="primary" @click="updates(scope.row)">用户详情</el-button>
							<el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
								@click="deleteuser(scope.row)">删除用户</el-button>
							<el-button size = "mini" type = "danger" @click = "updates1(scope.row)">封号</el-button>
						</template>
					</el-table-column>
				</el-table>
				<div style="text-align: center;margin-top: 10px;">
					<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
						:page-sizes="[10, 15, 20]" :page-size="limit" :current-page="page"
						layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
					</el-pagination>
				</div>
			</el-tab-pane> -->
      <el-tab-pane label="推广员用户" name="tuiguang">
        <el-table v-loading="tableDataLoading" :data="tableData.list">
          <el-table-column fixed prop="userId" label="编号" width="80" fixed="left">
          </el-table-column>
          <el-table-column fixed prop="nickName" label="昵称" width="150">
            <template slot-scope="scope">
              <span style="color: #f56c6c;">{{ scope.row.nickName ? scope.row.nickName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="图像">
            <template slot-scope="scope">
              <img v-if="scope.row.avatar==null" src="~@/assets/img/avatar.png" alt="" width="40" height="40">
              <img v-else :src="scope.row.avatar" alt="" width="40" height="40">
            </template>
          </el-table-column>
					<el-table-column prop="phone" label="手机号">
					  <template slot-scope="scope">
					    <span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row)">
					      {{ scope.row.phone ? scope.row.phone : '未绑定' }}
					    </span>
					  </template>
					</el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是普通用户">
           <template slot-scope="scope">
             <!-- <span v-if="scope.row.openId||scope.row.wxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==1">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>
         <el-table-column prop="zhifubaoName" label="是否是师傅用户">
           <template slot-scope="scope">
            <!-- <span v-if="scope.row.riderOpenId||scope.row.riderWxOpenId">是</span>
             <span v-else>否</span> -->
         		<span v-if="scope.row.userType==2">是</span>
         		<span v-else>否</span>
           </template>
         </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否是推广员">
            <template slot-scope="scope">
              <span v-if="scope.row.divideScale==0||scope.row.divideScale==null">否</span>
              <span v-else>是</span>
            </template>
          </el-table-column>
		  <el-table-column prop="rate" label="师傅佣金比例" width="150">
		    <template slot-scope="scope">
		      <span>{{scope.row.rate}}</span>
		      <div>
		        <el-input @keydown.enter.native="addition(scope.row,3)" v-model="scope.row.rate" clearable
		          placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
		          <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,3)"></i>
		        </el-input>
		      </div>
		    </template>
		  </el-table-column>
          <el-table-column prop="grade" label="一级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,1)" v-model="scope.row.divideScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,1)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="divideTwoScale" label="二级佣金比例" width="150">
            <template slot-scope="scope">
              <span>{{scope.row.divideTwoScale}}</span>
              <div>
                <el-input @keydown.enter.native="addition(scope.row,2)" v-model="scope.row.divideTwoScale" clearable
                  placeholder="例0.3" type="number" :min="0" style="width: 120px;font-size:14px;">
                  <i slot="suffix" class="el-input__icon el-icon-search" @click="addition(scope.row,2)"></i>
                </el-input>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="platform" label="渠道来源" width="120">
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="是否实名">
            <template slot-scope="scope">
              <span v-if="scope.row.checkCertification=='0'">待审核</span>
              <span v-else-if="scope.row.checkCertification=='1'">已实名</span>
              <span v-else>未实名</span>
            </template>
          </el-table-column>
          <el-table-column prop="invitationCode" label="邀请码"></el-table-column>
          <el-table-column label="邀请人邀请码">
            <template slot-scope="scope">
              <span style="color: #4f9dec;cursor: pointer;"
                @click="updates2(scope.row)">{{ scope.row.inviterCode ? scope.row.inviterCode : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cashQrCode" label="收款二维码" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.cashQrCode == null || scope.row.cashQrCode == ''">
                暂无收款二维码
              </div>
              <div v-else style="display:flex;flex-wrap: wrap;">
                <div style="margin: 2px;">
                  <el-popover placement="top-start" title="" trigger="hover">
                    <img style="width: 50px; height: 50px" :src="scope.row.cashQrCode" alt="" slot="reference">
                    <img style="width: 300px; height: 300px" :src="scope.row.cashQrCode" alt="">
                  </el-popover>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubaoName" label="支付宝名称">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubaoName ? scope.row.zhifubaoName : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="zhifubao" label="支付宝账号">
            <template slot-scope="scope">
              <span>{{ scope.row.zhifubao ? scope.row.zhifubao : '未绑定' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>

          <el-table-column prop="onLineFlag" label="师傅状态" fixed="right">
            <template slot-scope="scope">
              <span v-if="scope.row.onLineFlag==1">在线接单</span>
              <span v-else>停止接单</span>
            </template>
          </el-table-column>
          <el-table-column prop="state" label="用户状态" fixed="right">
            <template slot-scope="scope">
              <el-switch v-model="scope.row.status" @change="change(scope.row.status,scope.row.userId)"
                :active-value="openValue" :inactive-value="closeValue" active-color="#13ce66" inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="updates(scope.row)">用户详情</el-button>
              <el-button size="mini" type="danger" :disabled="!isAuth('userList:delete')"
                @click="deleteuser(scope.row)">删除用户</el-button>
              <!-- <el-button size = "mini" type = "danger" @click = "updates1(scope.row)">封号</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: center;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :page-sizes="[10, 15, 20]" :page-size="limit" :current-page="page"
            layout="total,sizes, prev, pager, next,jumper" :total="tableData.totalCount">
          </el-pagination>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        openValue: 1,
        closeValue: 2,
        state: 'false',
        limit: 10,
        page: 1,
        phone: null,
        nickName: '',
        invitationCode: '',
        nickNam: '',
        platform: '',
        isRelation: -1,
        isTuan: -1,
        value: '',
        member: -1,
        payData: [],
        grade: '',
        name: '',
        activeName: 'first',
        tableDataLoading: true,
        tableData: [],
        platforms: [{
            value: 'all',
            label: '全部'
          }, {
            value: 'wap',
            label: '网站'
          }, {
            value: 'app',
            label: 'APP'
          }, {
            value: 'weixin',
            label: '微信公众号'
          },
          {
            value: 'mp',
            label: '微信小程序'
          }
        ],
        campus: '',
        homeData1: [{
            id: '',
            name: '全部'
          }, {
            id: 'H5',
            name: 'H5'
          }, {
            id: 'app',
            name: 'app'
          },
          {
            id: '小程序',
            name: '小程序'
          }
        ],
        userType: '',
        isAgent: null,
        dailiName:'',
        inviterCode:'',
      }
    },
    methods: {
      // 状态
      change(val, userId) {
        this.$http({
          url: this.$http.adornUrl('adminerrand/updateStatus?userId=' + userId + '&status=' + val),
          method: 'post',
          data: this.$http.adornData({})
        }).then(({
          data
        }) => {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.dataSelect()
            }
          })
        })
      },
      // 详情跳转
      updates(row) {
        this.$router.push({
          path: '/userDetail',
          query: {
            userId: row.userId
          }
        })
      },
      // 详情跳转
      updates2(row) {
        // this.$router.push({
        // 	path: '/userDetail',
        // 	query: {
        // 		userId: row.superior
        // 	}
        // })
        // return
        this.$http({
          url: this.$http.adornUrl('adminerrand/selectUserId'),
          method: 'get',
          params: this.$http.adornParams({
            'invitationCode': row.inviterCode
          })
        }).then(({
          data
        }) => {
          if (data.code == 0) {
            this.$router.push({
              path: '/userDetail',
              query: {
                userId: data.data
              }
            })
          } else {
            this.$message({
              message: data.msg,
              type: 'warning',
              duration: 1500,
              onClose: () => {}
            })
          }
        })
      },
      handleSizeChange(val) {
        this.limit = val
        this.dataSelect()
      },
      handleCurrentChange(val) {
        this.page = val
        this.dataSelect()
      },
      handleSizeChange1(val) {
        this.limit = val
        this.paySelect()
      },
      handleCurrentChange1(val) {
        this.page = val
        this.paySelect()
      },
      // select自动选择
      selectTrigger() {
        this.dataSelect()
      },
      // 查询
      select() {
        this.page = 1
        this.dataSelect()
      },
      select2() {
        this.paySelect()
      },
      // 重置
      cleans() {
        this.page = 1
        this.platform = ''
        this.phone = null
        this.nickName = ''
        this.invitationCode = ''
        this.inviterCode = ''
        this.dataSelect()
      },
      //删除用户
      deleteuser(row) {
        let delid = row.userId
        this.$confirm(`确定删除此条信息?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('user/deleteUserByUserId/' + delid),
            method: 'post',
            params: this.$http.adornData({})
          }).then(({
            data
          }) => {
            this.$message({
              message: '删除成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.dataSelect()
              }
            })
          })
        })
      },
      // 封号
      updates1(row) {

      },

      // 筛选信息
      animeDat2(state) {
        this.dataSelect()
      },
      // 获取数据列表
      dataSelect() {
        this.tableDataLoading = true
        this.$http({
          url: this.$http.adornUrl('adminerrand/findAllUser'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.page,
            'limit': this.limit,
            'userType': this.userType,
            'phone': this.phone,
            'nickName': this.nickName,
            'invitationCode': this.invitationCode,
            'platform': this.platform,
            'isAgent': this.isAgent,
            'inviterCode':this.inviterCode,
          })
        }).then(({
          data
        }) => {
          this.tableDataLoading = false
          let returnData = data.data
          this.tableData = returnData
        })
      },
      handleClick(tab, event) {
        this.limit = 10
        this.page = 1
        if (tab._props.label == '全部用户') {
          this.userType = ''
          this.isAgent = null
          this.dataSelect()
        }
        if (tab._props.label == '普通用户') {
          this.userType = 1
          this.isAgent = null
          this.dataSelect()
        }
        if (tab._props.label == '师傅用户') {
          this.userType = 2
          this.isAgent = null
          this.dataSelect()
        }
        // if (tab._props.label == '代理用户') {
        // 	this.userType = ''
        // 	this.isAgent = 1
        // 	this.dataSelect()
        // }
        if (tab._props.label == '推广员用户') {
          this.userType = ''
          this.isAgent = 1
          this.dataSelect()
        }

      },
      // 修改佣金比例
      addition(row, index) {

        let userId = row.userId
        let grade = ''
        if (index == 1) {
          grade = row.divideScale
        } else if (index == 2) {
          grade = row.divideTwoScale
        }else {
          grade = row.rate
        }
		if(index==1||index==2){
			if (grade >= 0.5) {
			  this.$notify({
			    title: '提示',
			    duration: 1800,
			    message: '佣金比例不能高于0.5',
			    type: 'warning'
			  });
			  return
			}
		}


        if (grade < 0) {
          this.$notify({
            title: '提示',
            duration: 1800,
            message: '佣金比例最低为0',
            type: 'warning'
          });
          return
        }
        var datas = {}
        datas.userId = userId
        if (index == 1) {
          datas.divideScale = grade
        } else if(index == 2){
          datas.divideTwoScale = grade
        }else {
          datas.rate = grade
        }
        this.$confirm(`确定要修改佣金比例吗?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl('user/updateUserByUserId'),
            method: 'post',
            // params: this.$http.adornParams({
            data: this.$http.adornData(datas)
          }).then(({
            data
          }) => {
            if (data.code == 0) {
              this.$message({
                message: '修改成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.dataSelect()
                }
              })
            } else {
              this.$message({
                message: data.msg,
                type: 'warning',
                duration: 1500,
                onClose: () => {
                  this.dataSelect()
                }
              })
            }

          })
        }).catch(() => {})
      },
    },
    mounted() {
      this.dataSelect()
    }
  }
</script>

<style scoped="scoped">
  .el-button+.el-button {
    margin-left: 0 !important;
    margin-top: 5px !important;
  }
</style>
